import { Login } from "@/api/interface/index";
import { PORT1 } from "@/api/config/servicePort";
import { obj2fd } from "@/utils/index";
import http from "@/api";
// web登录超时
export const cfgSetSyscfg = (params: object) => {
  return http.post<Login.ResLogin>(PORT1 + `/admin/cfgSetSyscfg`, obj2fd(params), { loading: true }); // 正常 post json 请求  ==>  application/json
};
// 设置系统时间
export const cfgSettime = (params: object) => {
  return http.post<Login.ResLogin>(PORT1 + `/admin/cfgSettime`, params, { loading: true }); // 正常 post json 请求  ==>  application/json
};
// 获取系统时间
export const cfgGettime = () => {
  return http.post<Login.ResLogin>(PORT1 + `/admin/cfgGettime`, {}, { loading: true }); // 正常 post json 请求  ==>  application/json
};
// 重置地址
export const cfgSetManageip = (params: object) => {
  return http.post<Login.ResLogin>(PORT1 + `/admin/cfgSetManageip`, obj2fd(params), { loading: true }); // 正常 post json 请求  ==>  application/json
};
// 序列号
export const cfg_sn_get = () => {
  return http.get<Login.ResLogin>(PORT1 + `/system/cfg/cfg_sn_get`, {}, { loading: true }); // 正常 post json 请求  ==>  application/json
};
// 版本号
export const cfg_softcheck = () => {
  return http.get<Login.ResLogin>(PORT1 + `/system/cfg/cfg_softcheck`, {}, { loading: false }); // 正常 post json 请求  ==>  application/json
};
// 服务重启
export const cfgRestart = () => {
  return http.get<Login.ResLogin>(PORT1 + `/admin/cfgRestart`, {}, { loading: true }); // 正常 post json 请求  ==>  application/json
};
// 系统重启
export const cfgReboot = () => {
  return http.get<Login.ResLogin>(PORT1 + `/admin/cfgReboot`, {}, { loading: true }); // 正常 post json 请求  ==>  application/json
};
// 清空日志
export const cfgClearlog = () => {
  return http.get<Login.ResLogin>(PORT1 + `/admin/cfgClearlog`, {}, { loading: true }); // 正常 post json 请求  ==>  application/json
};
// 恢复出厂
export const cfgReset = () => {
  return http.get<Login.ResLogin>(PORT1 + `/admin/cfgReset`, {}, { loading: true }); // 正常 post json 请求  ==>  application/json
};

// 获取配置
export const cfgList = params => {
  return http.get<Login.ResLogin>(PORT1 + `/admin/cfgList`, params, { loading: true }); // 正常 post json 请求  ==>  application/json
};
// 系统升级
export const cfgSoftUpdate = params => {
  return http.post<Login.ResLogin>(PORT1 + `/admin/cfgSoftUpdate`, obj2fd(params), { loading: true }); // 正常 post json 请求  ==>  application/json
};
// 设置log
export const cfgSetSyslog = params => {
  return http.post<Login.ResLogin>(PORT1 + `/admin/cfgSetSyslog`, obj2fd(params), { loading: true }); // 正常 post json 请求  ==>  application/json
};
export const licenseUpload = params => {
  return http.post<Login.ResLogin>(PORT1 + `/admin/licenseUpload`, obj2fd(params), { loading: true }); // 正常 post json 请求  ==>  application/json
};
export const licenseCheck = () => {
  return http.get<Login.ResLogin>(PORT1 + `/admin/licenseCheck`, {}, { loading: true }); // 正常 post json 请求  ==>  application/json
};
export const licenseList = () => {
  return http.get<Login.ResLogin>(PORT1 + `/admin/licenseList`, {}, { loading: false }); // 正常 post json 请求  ==>  application/json
};
export const licenseRequest = () => {
  return http.get<Login.ResLogin>(PORT1 + `/admin/licenseRequest`, {}, { responseType: "blob", loading: true }); // 正常 post json 请求  ==>  application/json
};
export const srvcfgRestart = () => {
  return http.get<Login.ResLogin>(PORT1 + `/secure/srvcfgRestart`, {}, { responseType: "blob", loading: true }); // 正常 post json 请求  ==>  application/json
};
export const cfgPamGet = () => {
  return http.get<Login.ResLogin>(PORT1 + `/admin/cfgPamGet`, {}, { loading: true }); // 正常 post json 请求  ==>  application/json
};
export const cfgPamSet = data => {
  return http.post<Login.ResLogin>(PORT1 + `/admin/cfgPamSet`, obj2fd(data), { loading: true }); // 正常 post json 请求  ==>  application/json
};
export const sysCfgList = () => {
  return http.get<Login.ResLogin>(PORT1 + `/secure/sysCfgList`, {}, { loading: true }); // 正常 post json 请求  ==>  application/json
};
